// Always include this file if you want values to persist
// throughout the website
function startCourse()
{
		// check to see if cookies is enabled, otherwise, this won't work
	if( typeof sessionStorage == "undefined" || sessionStorage.disabled )
		{
			alert( "You must enable cookies for this course to work properly, dude." );
		}
	else
		{
				// if it is enabled, checked to see if this course was started
				// if it was not able to retrieve, the key "course_started", then
				// then this is the first time we are running the course
		
       		if( sessionStorage.getItem( "course_started" ) )
        		{
        
  					// clear the session storage
				sessionStorage.clear();

       			 	// set the "key" by giving it a value.  all values are strings!
    			sessionStorage.setItem( "course_started", "1" );
    		
    				// ...my Variable...
    				// sessionStorage.setItem("name", "Bob" );
   					// var value = sessionStorage.getItem( "name" );
    				// alert("Hello " + name);
    		 
    			sessionStorage.setItem( "page0", "unvisited" );
    			sessionStorage.setItem( "page1", "unvisited" );
			 	sessionStorage.setItem( "page2", "unvisited" );
			 	sessionStorage.setItem( "page3", "unvisited" );
     			 }
		}
	

}

function visitPage0()
{

	sessionStorage.setItem( "page0", "visited");
	checkComplete();
	
	//var alertMessage = sessionStorage.getItem( "page0" );
	
	//alert("Page 0: " + alertMessage );
}

function visitPage1()
{
	sessionStorage.setItem( "page1", "visited");
	checkComplete();
	
	//var alertMessage = sessionStorage.getItem( "page1" );
	
 	//alert("Page 1: " + alertMessage );

}

function visitPage2()
{
	sessionStorage.setItem( "page2", "visited");
	checkComplete();

	//var alertMessage = sessionStorage.getItem( "page2" );
	
	//alert("Page 2: " + alertMessage );

}

function visitPage3()
{
	sessionStorage.setItem( "page3", "visited");

	checkComplete();
	
	//var alertMessage = sessionStorage.getItem( "page3" );
	
	//alert("Page 3: " + alertMessage );

}


function checkComplete()
{
	
	var page0visited = sessionStorage.getItem( "page0" );
	var page1visited = sessionStorage.getItem( "page1" );
	var page2visited = sessionStorage.getItem( "page2" );
	var page3visited = sessionStorage.getItem( "page3" );
	
	if (page0visited == "visited" && page1visited =="visited" && page2visited == "visited" && page3visited == "visited" )
		{
		
		document.getElementById( "test-link" ).style.display = "inline";
		
		}

}